<!doctype html>
<html lang="zh-CN">
<head>
	<meta charset="utf-8" />
	<meta name="keywords" content="全新晶锐,晶锐,fabia,new fabia,快乐真人售,fabia晶锐" />
	<meta name="description" content="全新晶锐 只为快乐" />
	<title>全新晶锐 只为快乐</title>
	<meta name="viewport">
	<link rel="stylesheet" href="assets/js/libs/fancybox/jquery.fancybox.css">
	<link rel="stylesheet" href="assets/css/main.css">
</head>

<body>
<div class="main">
	<div class="main_inner">
		<div class="header cf">
			<div class="left logo logo_lt"><a target="_blank" href="http://www.skoda.com.cn/"><img src="assets/images/logo_lt.png" /></a></div>
			<div class="right logo logo_rt"><a target="_blank" href="http://www.skoda.com.cn/"><img src="assets/images/logo_rt.png" /></a></div>
		</div>
		<div class="footer cf">
			<div class="left logo logo_lb"><a target="_blank" href="http://www.skoda.com.cn/"><img src="assets/images/logo_lb.png" /></a></div>
			<div class="right logo logo_rb"><a target="_blank" href="http://www.skoda.com.cn/"><img src="assets/images/logo_rb.png" /></a></div>
		</div>
		<div class="loading" id="loading">
			<div class="loading_slide">
				<div class="loading_bar"></div>
				<div class="loading_txt"><span>0%</span>快乐加载中…</div>
			</div>
			<ul class="loading_page">
				<li class="page_item page_item_1"><img src="assets/images/load_1.png" /></li>
				<li class="page_item page_item_2"><img src="assets/images/load_2.png" /></li>
				<li class="page_item page_item_3"><img src="assets/images/load_3.png" /></li>
			</ul>
		</div>
		<div id="main_content" class="main_content">
			<div class="main_content_inner">
				<div id="menu" class="memuboard">
					<div class="menu_tigger"></div>
					<div id="menu" class="menu_inner">
						<ul id="menu_list" class="menu_list">
						</ul>
					</div>
				</div>
				<div class="viewboard viewboard_show cf">
					<div class="video_list_wrap h100">
						<ul class="video_list h100">
							<li class="h100">
								<div class="video_item h100">
									<div class="video_bg"><img class="w100 block" src="assets/images/show_bg_1.jpg" /></div>
									<div class="tit"><img class="mg_auto" src="assets/images/show_tit_1.png" /></div>
									<div class="video_content">
										<div class="video_cont"></div>
									</div>
								</div>
							</li>
							<li class="h100">
								<div class="video_item h100">
									<div class="video_bg"><img class="w100 block" src="assets/images/show_bg_2.jpg" /></div>
									<div class="tit"><img class="mg_auto" src="assets/images/show_tit_2.png" /></div>
									<div class="video_content">
										<div class="video_cont"></div>
									</div>
								</div>
							</li>
							<li class="h100">
								<div class="video_item h100">
									<div class="video_bg"><img class="w100 block" src="assets/images/show_bg_3.jpg" /></div>
									<div class="tit"><img class="mg_auto" src="assets/images/show_tit_3.png" /></div>
									<div class="video_content">
										<div class="video_cont"></div>
									</div>
								</div>
							</li>
						</ul>
					</div>
				</div>

				<div id="video_btn_prev" class="video_arr arr_left"></div>
				<div id="video_btn_next" class="video_arr arr_right"></div>
				<div id="pager" class="pager"></div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript" src="assets/js/libs/jquery.min.js"></script>
<script type="text/javascript" src="assets/js/s_code/AppMeasurement.js"></script>
<script type="text/javascript" src="assets/js/libs/jquery.easing.js"></script>
<script type="text/javascript" src="assets/js/libs/jquery.cookie.js"></script>
<script type="text/javascript" src="assets/js/libs/jquery.mousewheel.js"></script>
<script type="text/javascript" src="assets/js/libs/jquery.jscrollpane.min.js"></script>
<script type="text/javascript" src="assets/js/libs/preloadjs.min.js"></script>
<script type="text/javascript" src="assets/js/libs/fancybox/jquery.fancybox.pack.js"></script>

<script type="text/javascript" src="assets/js/creatjs/easeljs-0.6.0.min.js"></script>
<script type="text/javascript" src="assets/js/creatjs/tweenjs-0.4.0.min.js"></script>
<script type="text/javascript" src="assets/js/creatjs/movieclip-0.6.0.min.js"></script>
<script type="text/javascript" src="assets/js/creatjs/greensock/TweenMax.min.js"></script>
<script type="text/javascript" src="assets/js/apps/main.js"></script>
<script type="text/javascript">
	s.pageName="视频鉴赏页PC端"; 
	s.channel="视频鉴赏页PC端";
	s.t();
	var video_links = [
		'http://events.youku.com/2015/misc/api/video-files.php?vid=XOTM0MTQwMDY0',
		'http://events.youku.com/2015/misc/api/video-files.php?vid=XOTM0MTM2Mzky',
		'http://events.youku.com/2015/misc/api/video-files.php?vid=XOTM0MTM4NDIw'],
		volume_img = ['assets/images/vo1.png','assets/images/vo2.png'],
		play_img = ['assets/images/play.png','assets/images/pause.png'];
		
	function videoStart(){
		$('.video_list').each(function(index,item){
			var sub = $(this).find('>li.h100'),
				item_w = 0,
				index_active = 0,
				left_p = 0,
				self = this,
				pagerliarr = [];
			$('#pager').html('');
			sub.each(function(ind,itm){
				var pagerli = $('<li class="pager_item"><span></span></li>');
				pagerliarr.push(pagerli);
				if(ind==0){
					pagerli.addClass('active');
				};
				pagerli.on('click',function(e){
					index_active = ind;
					pushItem(index_active);
				});
				pagerli.appendTo('#pager');
				$(itm).css({width:$(window).width()});
				item_w = item_w+$(itm).width();
			});
			var sub_w = item_w/sub.length;
			$(item).css({'width':item_w});
			this.prev = $('#video_btn_prev');
			this.next = $('#video_btn_next');
			this.prev.hide();
			function pushItem(index_active){
				if(index_active==0){
					self.prev.hide();
				}else{
					self.prev.show();
				};
				if(index_active>=sub.length-1){
					self.next.hide();
				}else{
					self.next.show();
				};
				pagerliarr[index_active].addClass('active').siblings().removeClass('active');
				$(item).stop().animate({
						marginLeft: -index_active*sub_w
				}, {duration: 500, easing: 'easeInCubic',complete: function(){
					$(sub[index_active]).addClass("active").siblings().removeClass('active');
				}});
				$(item).find('.video_cont').each(function(){
					stopPlay(this);
				});
			};
			this.next.off('click').on('click',function(e){
				index_active++;
				if(index_active>sub.length-1){
					index_active = sub.length-1;
					return false;
				};
				pushItem(index_active);
			});
			this.prev.off('click').on('click',function(e){
				index_active--;
				if(index_active<0){
					index_active = 0;
					return false;
				};
				pushItem(index_active);
			});
		});
		$('.viewboard_show .video_bg').each(function(index,item){
			$(item).css({marginLeft:-$(item).width()/2,left:'50%',marginTop:-$(item).height()/2,top:'50%',width:'auto'});
			if($(item).height()<$(item).parent().height()){
				$(item).find('img').css({width:'auto',height:$(item).parent().height()});
				$(item).css({marginLeft:-$(item).width()/2,left:'50%',marginTop:-$(item).height()/2,top:'50%',width:'auto'});
			};
			
		});
	};
	$('.video_list>li.h100 .video_cont').each(function(index,item){
		var self = this;
		//html
		this.Media = $('<video id="media_'+index+'" src="'+video_links[index]+'" width="800" height="450"></video>');
		this.videoContent = $('<div class="video_cont_inner"><div class="video_btn"><img src="assets/images/play_btn.png" /></div><div class="video_wrap"></div><div class="controls"><div class="play_pause_btn"><img src="'+play_img[0]+'" /></div><div class="line"></div><div class="progress"><div class="progressBar"><div class="bufferBar"></div><div class="timeBar"></div></div></div><div class="time_label">00:00</div><div class="line"></div><div class="volume"><img src="'+volume_img[0]+'" /></div><div class="line"></div><div class="screen"><img src="assets/images/screen_btn.png" /></div></div></div>');
		this.Media.appendTo(this.videoContent.find('.video_wrap'));
		this.playing = false;
		this.videoContent.appendTo(item);

		//controls
		this.med = this.Media[0];
		this.ind = index;
		this.med.preload="auto";
		$(item).find('.play_pause_btn').off('click').on('click',function(){ //播放暂停按钮
			update(self);
		});
		$(item).find('.video_btn').off('click').on('click',function(){ //播放暂停按钮
			update(self);
		});
		$(item).find('.volume').off('click').on('click',function(){ //声音控制按钮
			self.med.muted = !self.med.muted;
			if(self.med.muted){
				$(item).find('.volume img').attr('src', volume_img[1]);
			}else{
				$(item).find('.volume img').attr('src', volume_img[0]);
			}
		});
		$(item).find('.screen').off('click').on('click',function(){ //全屏控制按钮
			if(self.med.requestFullScreen){
				self.med.requestFullScreen();
			}else if(self.med.webkitRequestFullScreen){
				self.med.webkitRequestFullScreen();
			}else if(self.med.mozRequestFullScreen){
				self.med.mozRequestFullScreen();
			}else if(self.med.msRequestFullscreen){
				self.med.msRequestFullscreen();
			}else{
				alert('您的浏览器版本过低，请升级浏览器');
			};
		});
		$(item).find('.progressBar').off('click').on('click',function(e){ //点击播放进度条
			var position = e.clientX - $(this).offset().left; //Click pos
			var percentage = 100 * position / $(this).width();
			$(item).find('.timeBar').css({"width":position+'px'});
			self.med.currentTime = self.med.duration * percentage / 100;
		});
		self.Media.on('timeupdate',function(e){
			startBuffer(self);
			timeUpdate(self);
		});
		$(window).resize(function(event) {
			self.Media.width($(self.videoContent).find('.video_wrap').width());
			self.Media.height($(self.videoContent).find('.video_wrap').height());
		});

		//for video src
		$.ajax({
			url: video_links[index],
			type: 'GET',
			dataType: 'xml',
			success: function(e){
				var d = $(e).find('mp4 url').text();
				self.Media.attr('src',d)
			}
		});
	});

	
	var startBuffer = function(item) {
		var maxduration = item.med.duration;
		var currentBuffer = item.med.buffered.end(0);
		var percentage = parseInt((currentBuffer/maxduration)*$(item).find('.progressBar').width());
		$(item).find('.bufferBar').css({"width":percentage+'px'});
		if(currentBuffer < maxduration) {
			setTimeout(function(){
				startBuffer(item);
			}, 500);
		}
	};
	function timeUpdate(item){
		var currentPos = item.med.currentTime; //Get currenttime
		var maxduration = item.med.duration; //Get video duration
		var percentage = parseInt(currentPos / maxduration *$(item).find('.progressBar').width());
		$(item).find('.timeBar').css({"width":percentage+'px'});
		
		var currentMinute = Math.floor(currentPos / 60)
		if(Number(currentMinute)<10) currentMinute = "0"+currentMinute;
		
		var currentSecond = Math.floor(currentPos % 60)
		if(Number(currentSecond)<10) currentSecond = "0"+currentSecond;

		$(item).find('.time_label').html(currentMinute + ":" + currentSecond);
	}
	function stopPlay(item){
		$('.play_pause_btn img').attr('src', 'assets/images/play.png');
		$('.video_cont .video_btn img').fadeIn();
		item.med.pause();
	};
	function update(item){
		if(item.med.paused){
			var s=s_gi(s_account);
			s.linkTrackVars="events";
			s.linkTrackEvents="event"+(44+item.ind);
			s.events="event"+(44+item.ind);
			s.tl(this,'o','custom');
			//播放状态
			$(item).find('.play_pause_btn img').attr('src', 'assets/images/pause.png');
			$(item).find('.video_btn img').fadeOut();
			item.med.play();
		}
		else{
			//暂停状态
			$(item).find('.play_pause_btn img').attr('src', 'assets/images/play.png');
			$(item).find('.video_btn img').fadeIn();
			item.med.pause();
		}
	};

</script>
</body>
</html>
